﻿using System.Collections.Concurrent;
using System.Drawing;

namespace WindowsFormsElementApp.ControlExtension.Theme
{
    public static class ThemeColorFactory
    {
        static readonly ConcurrentDictionary<Theme, ThemeColor> dic = new ConcurrentDictionary<Theme, ThemeColor>();

        public static ThemeColor GetThemeColor(Theme theme)
            => dic.GetOrAdd(theme, t => new ThemeColor(t));
    }

    public class ThemeColor
    {
        private readonly ITheme ColorTheme = new DefaultTheme();

        public ThemeColor(Theme theme)
        {
            switch (theme)
            {
                case Theme.Defult:
                    ColorTheme = new DefaultTheme();
                    break;
                case Theme.Test1:
                    ColorTheme = new Test1Theme();
                    break;
                default:
                    break;
            }
        }

        /// <summary>
        /// 主题色
        /// </summary>
        public Color ColorPrimary => ColorTheme.ColorPrimary;

        /// <summary>
        /// 成功颜色
        /// </summary>
        public Color ColorSuccess => ColorTheme.ColorSuccess;

        /// <summary>
        /// 警告颜色
        /// </summary>
        public Color ColorWarning => ColorTheme.ColorWarning;


        /// <summary>
        /// 危险颜色
        /// </summary>
        public Color ColorDanger => ColorTheme.ColorDanger;

        /// <summary>
        /// 信息颜色
        /// </summary>
        public Color ColorInfo => ColorTheme.ColorInfo;

        /// <summary>
        /// 主要文字颜色
        /// </summary>
        public Color ColorFontPrimary => ColorTheme.ColorFontPrimary;

        /// <summary>
        /// 常规文字颜色
        /// </summary>
        public Color ColorFontRegular => ColorTheme.ColorFontRegular;

        /// <summary>
        /// 次要文字颜色
        /// </summary>
        public Color ColorFontSecondary => ColorTheme.ColorFontSecondary;

        /// <summary>
        /// 占位文字颜色
        /// </summary>
        public Color ColorFontPlaceholder => ColorTheme.ColorFontPlaceholder;

        /// <summary>
        /// 一级边框颜色
        /// </summary>
        public Color ColorBorderBase => ColorTheme.ColorBorderBase;

        /// <summary>
        /// 二级边框颜色
        /// </summary>
        public Color ColorBorderLight => ColorTheme.ColorBorderLight;

        /// <summary>
        /// 三级边框颜色
        /// </summary>
        public Color ColorBorderLighter => ColorTheme.ColorBorderLighter;

        /// <summary>
        /// 四级边框颜色
        /// </summary>
        public Color ColorBorderExtraLight => ColorTheme.ColorBorderExtraLight;

        /// <summary>
        /// 基础背景色
        /// </summary>
        public Color ColorBackgroundBase => ColorTheme.ColorBackgroundBase;

        /// <summary>
        /// 基础白色
        /// </summary>
        public Color ColorBackgroundWhite => ColorTheme.ColorBackgroundWhite;

        /// <summary>
        /// 基础黑色
        /// </summary>
        public Color ColorBackgroundBlack => ColorTheme.ColorBackgroundBlack;

        /// <summary>
        /// 基础透明色
        /// </summary>
        public Color ColorBackgroundTransparent => ColorTheme.ColorBackgroundTransparent;
    }
}
